x86/time: adjust local system time initialization
authorJan Beulich <jbeulich@suse.com>
Wed, 3 Aug 2016 12:39:31 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Aug 2016 12:39:31 +0000 (14:39 +0200)
commitbb49fd3092a84ce151f5528794c0e612eeb4961a
treef61779ac8083357f8f110a22ff80f02b7cd19f8b
parent45a348ebaba3f6e0a26455a3ff181a41722943a0
x86/time: adjust local system time initialization

Using the bare return value from read_platform_stime() is not suitable
when local_time_calibration() is going to use its fast path: Divergence
of several dozen microseconds between NOW() return values on different
CPUs results when platform and local time don't stay in close sync.

Latch local and platform time on the CPU initiating AP bringup, such
that the AP can use these values to seed its stime_local_stamp with as
little of an error as possible. The boot CPU, otoh, can simply
calculate the correct initial value (other CPUs could do so too with
even greater accuracy than the approach being introduced, but that can
work only if all CPUs' TSCs start ticking at the same time, which
generally can't be assumed to be the case on multi-socket systems).

This slightly defers init_percpu_time() (moved ahead by commit
dd2658f966 ["x86/time: initialise time earlier during
start_secondary()"]) in order to reduce as much as possible the gap
between populating the stamps and consuming them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/smpboot.c
xen/arch/x86/time.c
xen/include/asm-x86/time.h